package com.domcer.ultra.menu.common.constants;

import com.domcer.ultra.menu.engine.action.*;
import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Arrays;

/**
 * @Author hang.wang
 * @Date 2025/1/31 12:49
 */
@Getter
@AllArgsConstructor
public enum ActionTypeEnum {
    COMMAND(new CommandAction()),
    MESSAGE(new MessageAction()),
    SOUND(new SoundAction()),
    BROADCAST(new BroadcastAction()),
    CONSOLE(new ConsoleAction())
    ;

    private final Action action;

    public static ActionTypeEnum getByName(String name) {
        return Arrays.stream(values())
                .filter(actionTypeEnum -> actionTypeEnum.name().equalsIgnoreCase(name))
                .findFirst()
                .orElse(COMMAND);
    }
}
